package com.tarena.lbs.content.dao.repository.articleImpl;

import com.tarena.lbs.content.dao.mapper.ArticleMapper;
import com.tarena.lbs.content.dao.repository.ArticleRepository;
import com.tarena.lbs.content.pojo.po.ActionSearchPO;
import com.tarena.lbs.content.pojo.po.ArticleCategoryPO;
import com.tarena.lbs.content.pojo.po.ArticleSearchPO;
import com.tarena.lbs.content.pojo.query.ArticleQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Set;

@Repository
public class ArticleRepositoryImpl implements ArticleRepository {
    @Autowired
    private ArticleMapper articleMapper;

    @Override
    public void insert(ArticleSearchPO po) {
        articleMapper.insert(po);
    }

    @Override
    public List<ArticleSearchPO> list() {
        List<ArticleSearchPO> list = articleMapper.list();
        return list;
    }

    @Override
    public Set<String> articleLabels(ArticleQuery articleQuery) {
        Set<String> articleLabels = articleMapper.articleLabels(articleQuery);
        return articleLabels;
    }

    @Override
    public ArticleSearchPO articleDetail(String id) {
        ArticleSearchPO po = articleMapper.selectById(id);
        return po;
    }

    @Override
    public void articleBehavior(ActionSearchPO po) {
        articleMapper.articleBehavior(po);
    }

    @Override
    public ActionSearchPO getBehaviorLists(ArticleQuery query) {
        ActionSearchPO po = articleMapper.getBehaviorLists(query);
        return po;
    }
}
